<?php

namespace App\Notifications;

use Illuminate\Notifications\Messages\MailMessage;
use App\Models\EmailVerification as Model;

class EmailVerification extends AbstractMailNotification
{

    /**
     * Token.
     *
     * @var string
     */
    public $token;

    /**
     * 过期时间:分钟
     *
     * @var int
     */
    public $lifeTime;

    /**
     * EmailVerification constructor.
     *
     * @param string $token
     * @param int $lifeTime
     */
    public function __construct($token, $lifeTime = Model::EXPIRED_MINUTES)
    {
        $this->token = $token;
        $this->lifeTime = $lifeTime;
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->markdown('emails.email-verification', [
                'token' => $this->token,
                'lifeTime' => $this->lifeTime
            ]);
    }
}
